Public Class LinkButton
    Inherits WebControls.LinkButton
    Implements IJObjective

    Private m_sNamespace As String
    Private m_sPropertyName As String
    Private m_sConstructor As String
    Private m_sDataID As String

    Public Property [Namespace]() As String Implements IJObjective.Namespace
        Get
            Return m_sNamespace
        End Get
        Set(ByVal value As String)
            m_sNamespace = value
        End Set
    End Property

    Public Property ObjectName() As String Implements IJObjective.ObjectName
        Get
            Return m_sPropertyName
        End Get
        Set(ByVal value As String)
            m_sPropertyName = value
        End Set
    End Property

    Public Property Constructor() As String Implements IJObjective.Constructor
        Get
            Return m_sConstructor
        End Get
        Set(ByVal value As String)
            m_sConstructor = value
        End Set
    End Property

    Public Property DataID() As String Implements IJObjective.DataID
        Get
            Return m_sDataID
        End Get
        Set(ByVal value As String)
            m_sDataID = value
        End Set
    End Property

    Public Overrides ReadOnly Property ClientID() As String
        Get
            Return ID
        End Get
    End Property

    Public Sub New()
        DataID = Common.GetUniqueID(Context)
    End Sub

    Private Sub Button_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        EnsureChildControls()

        If String.IsNullOrEmpty(Constructor) Then
            Constructor = "new jObjective.DataObject($('#" & DataID & "'))"
        End If
    End Sub

    Private Sub LinkButton_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ID = DataID
    End Sub
End Class